import BigNumber from 'bignumber.js';

/**
 * a + b 
 */
export const bigPlus = (a: number | string, b: number | string) => {
    return new BigNumber(a).plus(new BigNumber(b)).toFixed()
}
export const bigNumberPlus = (a: number | string, b: number | string) => {
    return new BigNumber(a).plus(new BigNumber(b))
}
export const bigMinus = (a: number | string, b: number | string) => {
    return new BigNumber(a).minus(new BigNumber(b)).toFixed()
}
export const bigMult = (a: number | string, b: number | string) => {
    return new BigNumber(a).multipliedBy(new BigNumber(b)).toFixed()
}

export const bigDiv = (a: number | string, b: number | string) => {
    return new BigNumber(a).div(new BigNumber(b)).toFixed()
}
export const bigDivGetInteger = (a: number | string, b: number | string) => {
    return new BigNumber(a).div(new BigNumber(b)).decimalPlaces(0,BigNumber.ROUND_DOWN).toFixed()
}

//a是否大于b
export const isGt = (a: number | string, b: number | string) => {
    return new BigNumber(a).gt(new BigNumber(b))
}
//是否大于等于
export const isGtEqualTo = (a: number | string, b: number | string) => {
    return new BigNumber(a).isGreaterThanOrEqualTo(new BigNumber(b))
}
//a是否小于b
export const isLess = (a: number | string, b: number | string) => {
    return new BigNumber(a).isLessThan(new BigNumber(b))
}
//a是否小于等于b
export const isLessEqualTo = (a: number | string, b: number | string) => {
    return new BigNumber(a).isLessThanOrEqualTo(new BigNumber(b))
}
//是否等于
export const isEqualTo = (a: number | string, b: number | string) => {
    return new BigNumber(a).isEqualTo(new BigNumber(b))
}